package com.neuedu.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.neuedu.entity.EmploymentApplication;
import com.neuedu.mapper.EmploymentApplicationMapper;
import com.neuedu.service.EmploymentApplicationService;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

@Service
public class EmploymentApplicationImpl extends ServiceImpl<EmploymentApplicationMapper,EmploymentApplication> implements EmploymentApplicationService {
    @Override
    public boolean add(EmploymentApplication employmentApplication) {
        return this.save(employmentApplication);
    }

    @Override
    public boolean delete(long tableId) {
        return this.removeById(tableId);
    }

    @Override
    public boolean update(EmploymentApplication employmentApplication) {
        return this.updateById(employmentApplication);
    }

    @Override
    public List<EmploymentApplication> checkByUserId(long id) {
        QueryWrapper<EmploymentApplication> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", id)
                .orderByDesc("id"); // 根据 user_id 查询
        return this.list(queryWrapper); // 使用 MyBatis-Plus 的 list 方法查询符合条件的记录
    }

}
